The present invention relates generally to computer memory management and, more specifically, to a relocation table and corresponding relocation blocks for use in such management.
Virtual memory, which is an imaginary memory area supported by the operating system of a computer, increases the set of addresses a program can use. Usually, this set of addresses is referred to as the address space and is divided into units or pages. While virtual addresses are used to access virtual memory, physical addresses are used to locate data stored in physical locations or physical memory corresponding to the virtual addresses. Contemporary computers commonly use translation look-aside buffers or tables to cache virtual to physical page address translations. As program applications grow in size and their data requirements increase, the number of pages required by the applications and hence the number of translations that need to be cached in the translation look-aside buffer increases. Unfortunately, the translation look-aside buffer is often the cycle-time limiter in processors and increasing its size exacerbates the problem.
To limit the number of entries needed in a translation look-aside buffer and thereby reducing its cycle time, designers usually increase the size of memory pages, which decreases the number of entries the translation look-aside buffer needs to contain. This is because a given amount of memory can be represented by fewer pages. However, this approach also increases the time needed for moving a memory page and the number of page faults, which occur when a memory page is accessed but the page is not in memory. In addition, larger pages in memory, especially those of gigabyte sizes, result in more chance that large fractions of the page are not used by the portion of the applications currently executing. This leads to inefficient use of memory.
Some approaches have balanced the disparate needs of large page sizes, small number of translation look-aside buffer entries, and penalties due to moving or copying large pages. However, in these approaches, translation look-aside buffers are still cycle time limiters. xe2x80x9cSuper pagesxe2x80x9d have been investigated to combine multiple smaller pages to create one larger page, which combines several translation look-aside buffer entries into one and allows each individual page creating the super page to be stored in non-contiguous memory locations. Nevertheless, all pages are usually stored in system memory or swap memory, which refers to storage areas for data that is not in system memory. Normally, the operating system, during execution of a program, keeps as much data in the system memory as possible, and leaves the rest of the data somewhere else, e.g., in a hard disc. When the system needs the data, it swaps some of the data in system memory with some of the data in the disc.
Based on the foregoing, it is clearly desirable that mechanisms be provided to solve the above deficiencies and related problems.
The present invention, in various embodiments, provides techniques for managing memory in computer systems. In one embodiment, each memory page is divided into relocation blocks located at various physical locations, and a relocation table is created with entries used to locate these blocks. To access memory for a particular piece of data, a program first uses a virtual address of the data, which, through a translation look-aside buffer, is translated into a physical address within the computer system. Using the relocation table, the physical address is then translated to a relocation address that identifies the relocation block containing the requested data. From the identified relocation block, the data is returned to the program with the original physical address.
In one aspect, the relocation blocks are much smaller than the pages maintained by the translation look-aside buffer. Moving these blocks, e.g., between memory and disc, from disc to buffers, etc., is therefore more efficient. In accordance with the techniques disclosed herein, a computer system can define a page to be as large as needed, and the bigger the page, the bigger the number of relocation blocks is divided from a page. Consequently, the conflicting effects of increasing or decreasing the page sizes in various current approaches are removed. Because the page is divided into smaller blocks, the problem of finding enough contiguous free memory to hold a large memory page is also eliminated. Additionally, each relocation block can be located at various locations, e.g., some blocks are in physical memory, some are in hard disc, etc.